Skip to content

feat(agent): inject LLMProvider instance into STARAgent#16

Merged
ngoclam9415 merged 9 commits into
developfrom
feat/inject-llm-provider-instance
Jun 28, 2026
Merged

feat(agent): inject LLMProvider instance into STARAgent#16
ngoclam9415 merged 9 commits into
developfrom
feat/inject-llm-provider-instance

Conversation

@ngoclam9415

Copy link
Copy Markdown
Contributor

Summary

  • Let callers pass a pre-built LLMProvider instance into STARAgent via a dedicated llm_provider_instance param (no union overload of the existing llm_provider string), and re-point it mid-session via set_llm_provider(...).
  • Normalize the instance to a single LLM once at the agent boundary, then fan that one LLM out to three sinks so the actual call site uses it (no split-brain): agent _llm_client, runtime LLMCaller (via existing runtime.set_llm), and LTMemoryRLMResource.
  • RLMResource and LTMemory gain llm= params + set_llm() to accept/forward the injected instance; the legacy provider+model string path stays lazy and behaviorally unchanged (no API key needed at construction).
  • llm_client property setter now also fans out to the LTMemory sink, closing a partial-update footgun now that LTMemory is a live LLM sink.

Changes

  • dana/common/resource/rlm_resource.pyllm param + set_llm (leaf sink)
  • dana/core/memory/ltmemory.pyllm param + set_llm (forwards to RLMResource)
  • dana/core/agent/star_agent.pyllm_provider_instance param, _apply_llm_provider() fan-out, set_llm_provider(), _llm_config sync on re-point, setter→ltmemory fan-out
  • tests/unit/core/test_inject_llm_provider.py — 9 tests: no-split-brain invariant, re-point all sinks (instance + string paths), ltmemory injection, legacy lazy regression

Test Plan

  • uv run pytest tests/unit/core/test_inject_llm_provider.py — 9 passed
  • Regression: test_agent_runtime.py, tests/unit/core/star, test_ltmemory.py, test_staragent_ltmemory.py — 84 passed total, no regressions
  • Legacy string path verified lazy (_llm_client is None at construction, no key required)

Spec: docs/superpowers/specs/2026-06-08-inject-llm-provider-instance-design.md
Plan: docs/superpowers/plans/2026-06-08-inject-llm-provider-instance.md

@ngoclam9415 ngoclam9415 merged commit 7a479fc into develop Jun 28, 2026
1 check failed
@ngoclam9415 ngoclam9415 deleted the feat/inject-llm-provider-instance branch June 28, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant